{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5ef68997-06a0-41a5-b412-b54392134864",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123 + 100 = 223\n",
      "123 - 100 = 23\n",
      "123 * 100 = 12300\n",
      "123 / 100 = 1.23\n",
      "2 ** 10 = 1024\n"
     ]
    }
   ],
   "source": [
    "#MyMath.py\n",
    "def add(x, y): #定义函数\n",
    "    return x + y  #加\n",
    "def sub(x, y):\n",
    "    return x - y  #减\n",
    "def mul(x, y):\n",
    "    return x * y  #乘\n",
    "def div(x, y):\n",
    "    return x / y  #除\n",
    "def power(x, y):\n",
    "    return x ** y  #幂\n",
    "#测试代码\n",
    "if __name__ == '__main__': #如果独立运行时，则运行测试代码\n",
    "    print('123 + 100 =', add(123, 100))\n",
    "    print('123 - 100 =', sub(123, 100))\n",
    "    print('123 * 100 =', mul(123, 100))\n",
    "    print('123 / 100 =', div(123, 100))\n",
    "    print('2 ** 10 =', power(2, 10))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b015c371-0e53-4e0a-8e4e-aae2dedc94b7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
